<template>
    <div class="feedback">
        <pub-top isBorder="true" title="意见反馈"></pub-top>


        <!-- 反馈内容 -->
        <div class="feedback-txt flexv mt2">
            <div class="back-head">反馈内容</div>
            <div class="back-txt flex">
                <textarea cols="30" rows="10" class="flex1" placeholder="请输入遇到的问题或建议" v-model="txt"></textarea>
            </div>

            <div class="back-sub" @click="submit">提交</div>
        </div>

    </div>
</template>
<script>
import Vue from 'vue';
import { mapState } from 'vuex';
import { Toast, List } from 'vant';
import pubTop from '@/components/top';

Vue.use(Toast);
export default {
    data(){
        return {
            txt: null, //问题或建议
        }
    },
    created(){

    },
    computed: {
        ...mapState(['user'])
    },
    components: {
        pubTop
    },
    methods: {
        submit(){
            if(!this.txt){
                Toast({
                    duration: 1600,
                    message: '反馈内容不能为空'
                })
                return
            }
            this.axios.get('http://jxjq.0791jr.com/index.php?m=App&c=Mine&a=option', {
                params: {
                    uid: this.$store.state.user.uid,
                    content: this.txt
                }
            }).then(res => {
                if(res.status == 200){
                    const data = res.data;
                    this.txt = ''
                    Toast({
                        duration: 1600,
                        message: data.msg
                    });
                    setTimeout(function(){
                        this.$router.push({name:"Feedback"})
                    },2000)
                }
            })
        }
    },
}
</script>
<style lang="less" scoped>
.feedback {
    min-height: 100vh;
    background-color: #f0f0f0;
    .feedback-txt {
        .back-head {
            width: 100%;
            height: 0.9rem;
            padding: 0 0.28rem;
            font-size: 0.3rem;
            line-height: 0.9rem;
            font-weight: bold;
            color: #333;
            border-bottom: 1px solid #dedede;
            background-color: #fff;
        }
        .back-txt {
            padding: 0.2rem 0.4rem;
            background-color: #fff;
            textarea{
                font-size: 0.3rem;
                line-height: 150%;
                color: #333;
                resize: none;
            }
        }
        .back-sub {
            width: 6.9rem;
            height: 0.88rem;
            margin: 1.4rem auto 0;
            border-radius: 0.1rem;
            font-size: 0.34rem;
            line-height: 0.88rem;
            text-align: center;
            color: #fff;
            background-color: #1f78ff;
            cursor: pointer;
        }
    }
}
</style>

